package com.gym.client;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.gym.pojo.User;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.cloud.openfeign.SpringQueryMap;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

@FeignClient(name = "gateway",path = "/userprovider",contextId = "userprovider")
//@FeignClient(name = "userprovider",contextId = "usersprovider")
public interface UserClient {
    @RequestMapping("loginyh")
    public User loginyh(@RequestParam String account,@RequestParam String password);

    @RequestMapping("/listUser")
    public List<User> selListUser(@RequestParam(name = "name")String name);
    @RequestMapping("/selectsj")
    public JSONObject selectsj(@RequestParam String username,@RequestParam int userId,@RequestParam int page,@RequestParam int limit);
    @RequestMapping("/selListUser")
    public JSONObject selListUser(@RequestParam(name = "name")String name,
                                  @RequestParam(name = "index")int index,
                                  @RequestParam(name = "size")int size);

    @RequestMapping("/insUser")
    public boolean insUser(@SpringQueryMap User user);

    @RequestMapping("/updUser")
    public boolean updUser(@SpringQueryMap User user);

    @RequestMapping("/delUserById")
    public boolean delUserById(@RequestParam(name = "userId")int userId);

    @RequestMapping("/selByAccount")
    public int selByAccount(@RequestParam(name = "account")String account);

    @RequestMapping("/provingByPwd")
    public boolean provingByPwd(@RequestParam(name = "userId")int userId,
                                @RequestParam(name = "pwd")String pwd,
                                @RequestParam(name = "name")String name);

    @RequestMapping("/updUserBypwd")
    public boolean updUserBypwd(@RequestParam(name = "userId")int userId,
                                @RequestParam(name = "pwd")String pwd);

    @RequestMapping("/selIdByAcc")
    public int selIdByAcc(@RequestParam(name = "account")int account);
}
